package mysql

import "gorm.io/gorm"

type Doctor struct {
	gorm.Model
	Username string `gorm:"type:varchar(50);not null;"`
	Tel      string `gorm:"type:char(11);not null;"`
	Address  string `gorm:"type:varchar(50);not null;"`
}

func (d *Doctor) DocAdd(db *gorm.DB) error {
	return db.Debug().Create(d).Error
}

func (d *Doctor) FindDocById(db *gorm.DB, id int64) error {
	return db.Debug().Where("id = ?", id).Find(d).Error
}

func (d *Doctor) DocUpdate(db *gorm.DB) error {
	return db.Debug().Updates(d).Error
}

func (d *Doctor) DocDetail(db *gorm.DB, id int64) error {
	return db.Debug().Where("id = ?", id).First(d).Error
}
